<?php
$pathArr = explode("/", $_SERVER["PHP_SELF"]);
$contextPath = $pathArr[1];
$rootPath = $_SERVER["DOCUMENT_ROOT"];
include_once $rootPath . "/" . $contextPath . "/apps/ManagerIUDS.php";
$managerIUDS = new ManagerIUDS();

$mode = $_GET["mode"];
if($mode == "update"){
	$getListMediCalCare = $managerIUDS->queryData("*", "medical_care", " WHERE medical_care_id = ".$_GET["medical_care_id"], "1", "=");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>.: Medical Care Detail :.</title>
<?php
require_once($rootPath . "/" . $contextPath . "/includes/css_inc.php");
require_once($rootPath . "/" . $contextPath . "/includes/js_inc.php");
?>
<script type="text/javascript">
			$(document).ready(function(){ 
				$("#save_data").click(function(){
					var result = true;
					if($("#medical_care_name").val()=="" || $("#medical_care_name").val()==null){
						alert("กรุณากรอกชื่อการรักษา");
						$("#medical_care_name").focus(); 
						result = false;
					}else if($("#price").val()=="" || $("#price").val()==null){
						alert("กรุณากรอกราคาการรักษา");
						$("#price").focus(); 
						result = false;
					}
					if(result){
						$("#frm1").submit();
					}
				});
			}); 
		</script>
</head>
<body>
<center>
<form name="frm1" id="frm1" action="../actions/medical_care_action.php" method="post">
<table border="0" width="75%">
	<thead class="ui-widget">
		<tr class="ui-widget-header">
			<th colspan="2" align="left">&nbsp;&nbsp;&nbsp;รายละเอียดการรักษา</th>
		</tr>
	</thead>
	<tbody class="ui-widget-content">
		<tr>
			<td align="right">ชื่อการรักษา :</td>
			<td><input type="text" name="medical_care_name" id="medical_care_name" value="<?=$getListMediCalCare["medical_care_name"]?>"></td>
		</tr>
		<tr>
			<td align="right">รายละเอียดการรักษา :</td>
			<td><textarea name="medical_care_detail" id="medical_care_detail" cols="21" rows="5"><?=$getListMediCalCare["medical_care_detail"]?></textarea></td>
		</tr>
		<tr>
			<td align="right">ราคา :</td>
			<td><input type="text" name="price" id="price" value="<?=$getListMediCalCare["price"]?>" onkeypress="return numbersOnly(event, false);"></td>
		</tr>
		<tr>
			<td colspan="2" align="center">
			<input type="button" name="save_data" id="save_data" value="บันทึก">
			<input type="button" value="ยกเลิก"	onclick="window.location='medical_care_main.php';"></td>
		</tr>
	</tbody>
</table>
<input type="hidden" id="mode" name="mode" value="<?=$mode?>">
<input	type="hidden" id="medical_care_id" name="medical_care_id" value=<?=$_GET["medical_care_id"]?>>
</form>
</center>
</body>
</html>
